package acm.蓝桥杯;

import java.io.*;
import java.util.*;
public class F星际旅行 {
    /**
     * 一个无向无权图
     * q次询问，求出每次能到达的所有点。
     * 对所有点求个和，取个均值
     */
    static int n, m, q;
    static int maxN = 1010, maxM = 50000, maxQ = 50000;
    static List<Integer>[] list;
    static int[] queue=new int[maxN];
    static int[] sum=new int[maxN];

    public static void main(String[] args) {
        Reader2 sc = new Reader2();
        n=sc.nextInt();
        m=sc.nextInt();
        q=sc.nextInt();
        list=new List[n+1];
        for (int i = 1; i < list.length; i++) {
            list[i]=new ArrayList<>();
        }
        for (int i = 0; i < m; i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            list[u].add(v);
            list[v].add(u);
        }
        long count=0;
        for (int i = 0; i < q; i++) {
            int s = sc.nextInt();
            int step = sc.nextInt();
            int bfs = bfs(s, step);
            count+=bfs;
        }
        System.out.printf("%.2f",1.0*count/q);
    }
    public static int bfs(int s,int step){
        int h=0,t=0;
        queue[t++]=s;
        Set<Integer> set=new HashSet<>();
        set.add(s);
        while (h!=t&&step>0){
            int size=(t-h+queue.length)%queue.length;

            for (int i = 0; i < size; i++) {
                int cur = queue[h++];
                for (Integer to : list[cur]) {
                    if (set.contains(to)) continue;
                    set.add(to);
                    queue[t++]=to;
                }
            }
            step--;
        }
        return set.size();
    }
    static
    class Reader2 {
        private StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        public int nextInt(){
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
        public double nextDouble(){
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return in.nval;
        }
    }

}
